package com.bitdf.txing.group.feign.impl.search;

import com.bitdf.txing.common.utils.R;
import com.bitdf.txing.product.entity.BrandEntity;
import com.bitdf.txing.product.service.AttrService;
import com.bitdf.txing.product.service.BrandService;
import com.bitdf.txing.product.vo.AttrRespVo;
import com.bitdf.txing.search.feign.EsProductFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Lizhiwei
 * @date 2023/9/6 19:59:38
 * 注释：
 */
@Service
@ConditionalOnProperty(value = "tx.deploy.mode", havingValue = "standalone")
public class EsProductFeignServiceImpl implements EsProductFeignService {
    @Autowired
    AttrService attrService;
    @Autowired
    BrandService brandService;
    @Override
    public R attrInfo(Long attrId) {
        AttrRespVo respVo=attrService.getAttrInfo(attrId);
        return R.ok().put("attr", respVo);
    }

    @Override
    public R brandsInfo(List<Long> brandIds) {
        List<BrandEntity> brand = brandService.getBrandsByIds(brandIds);
        return R.ok().put("brand", brand);
    }
}
